package com.czy.owner.api;

import android.text.TextUtils;

import com.czy.owner.net.api.BaseApi;
import com.czy.owner.net.listener.HttpOnNextListener;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;

import java.util.HashMap;

import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by wangyang on 2017/5/11 0011.
 */

public class SaveUserLocationApi extends BaseApi {
    private String session;
    private String userLocationId;
    private String provinceId;
    private String cityId;
    private String areaId;
    private String detailLocation;
    private String contact;
    private String contactUser;
    private String isDefault;

    public SaveUserLocationApi(HttpOnNextListener listener, RxAppCompatActivity rxAppCompatActivity) {
        super(listener, rxAppCompatActivity);
        setShowProgress(true);
        setCache(false);
        setCookieNetWorkTime(0);//有网缓存0s,在0s内点击无效

    }

    public String getSession() {
        return session;
    }

    public void setSession(String session) {
        this.session = session;
    }

    public String getUserLocationId() {
        return userLocationId;
    }

    public void setUserLocationId(String userLocationId) {
        this.userLocationId = userLocationId;
    }

    public String getProvinceId() {
        return provinceId;
    }

    public void setProvinceId(String provinceId) {
        this.provinceId = provinceId;
    }

    public String getCityId() {
        return cityId;
    }

    public void setCityId(String cityId) {
        this.cityId = cityId;
    }

    public String getAreaId() {
        return areaId;
    }

    public void setAreaId(String areaId) {
        this.areaId = areaId;
    }

    public String getDetailLocation() {
        return detailLocation;
    }

    public void setDetailLocation(String detailLocation) {
        this.detailLocation = detailLocation;
    }

    public String getContact() {
        return contact;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }

    public String getContactUser() {
        return contactUser;
    }

    public void setContactUser(String contactUser) {
        this.contactUser = contactUser;
    }

    public String getIsDefault() {
        return isDefault;
    }

    public void setIsDefault(String isDefault) {
        this.isDefault = isDefault;
    }

    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);
        HashMap<String, Object> map = new HashMap<>();
        map.put("session", getSession());
        map.put("userLocationId", getUserLocationId());
        map.put("provinceId", getProvinceId());
        map.put("cityId", getCityId());
        map.put("areaId", getAreaId());
        map.put("detailLocation", getDetailLocation());
        map.put("contact", getContact());
        map.put("contactUser", getContactUser());
        map.put("isDefault", getIsDefault());
        return service.OwnShopSaveUserLocationApi(map);
    }
}
